// @ts-ignore
import styled from "styled-components";
type propsType={
  $size?:Number,
  $coverUrl?:String,
  $backgroundColor?:String,
  $isShowBottomBorder?:Boolean,
  $isShowMusicCover?:Boolean,
}
const MusicItemStyle=styled.div<propsType>`
  position: relative;
  display: flex;
  margin: 10px 45px;
  background-color: ${(props:propsType)=>props.$backgroundColor || "#eee"};
  width: ${(props:propsType)=>props.$size?`calc(${props.$size}px * 4)`:"fit-content"};
  height: ${(props:propsType)=>props.$size?props.$size:150}px;
  border-bottom: ${(props:propsType)=>props.$isShowBottomBorder?"1px solid #fefefe;":""};
  border-radius: calc(${(props:propsType)=>props.$size?props.$size:150}px / 15);
  max-width: 100%;
  overflow: hidden;
  .music-cover-box{
    position: relative;
    width: ${(props:propsType)=>props.$size?props.$size:150}px;
    height: ${(props:propsType)=>props.$size?props.$size:150}px;
  }
  .music-cover-image{
    position: relative;
    z-index: 0;
    width: ${(props:propsType)=>props.$size?props.$size:150}px;
    height: ${(props:propsType)=>props.$size?props.$size:150}px;
    background-image: url(${(props:propsType)=>props.$coverUrl || "https://y.qq.com/music/photo_new/T002R300x300M000002eVElz3eLwSx_1.jpg?max_age=2592000"});
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;
    transition: all 500ms;
  }
  .music-cover-mask{
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.2);
  }
  .music-cover-image:hover{
    background-size: 110% 110%;
  }
  .music-cover-image:hover .music-cover-mask{
    display: block;
  }
  
  .music-cover-mask:hover .music-play-btn{
    opacity: 1;
  }
  .music-play-btn{
    position: absolute;
    width: fit-content;
    height: fit-content;
    opacity: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: ${(props:propsType)=>props.$size?`calc(${props.$size}px / 2.7)`:"30px"};;
    color: #FFFFFF;
    cursor: pointer;
    transition: all 500ms;
  }
  .music-play-btn:hover{
    color: var(--theme-color);
  }
  

  /* 是否显示音乐封面，如果需要就加载，不需要这不加载该css样式 */
  ${(props:propsType)=>
    props.$isShowMusicCover?
    `.music-cover-image::after{
      content: "";
      position: absolute;
      left: calc(${props.$size?props.$size:150}px / 8.3);
      z-index: -1;
      width: 100%;
      height: 100%;
      background-image: url(${require("../../../assets/image/qqmusic_mask.png")});
      background-size: 100% 100%;
    }`:""
  }
 
  .music-info-box{
    display: flex;
    padding-left: ${(props:propsType)=>props.$size?`calc(${props.$size}px / 3.9)`:"38px"};
  }
  .music-message-box{
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .music-name{
    width: min-content;
    max-width: ${(props:propsType)=>props.$size?`${props.$size as number * 2}px`:"calc(100% - 60px)"};
    margin: 15px 0;
    white-space: nowrap;
    font-size: ${(props:propsType)=>props.$size?`calc(${props.$size}px / 7)`:"19px"};
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
  }
  .music-name:hover{
    color: var(--theme-color);
  }
  .music-sing{
    width: fit-content;
    font-size: ${(props:propsType)=>props.$size?`calc(${props.$size}px / 8.5)`:"15px"};
    color: #888888;
    cursor: pointer;
  }
  .music-sing:hover{
    color: var(--theme-color);
  }
  .music-timer{
    position: absolute;
    right: 1px;
    top: 50%;
    transform: translate(0 -50%);
    color: #aaa;
    height: ${(props:propsType)=>props.$size?props.$size:150}px;
    width: ${(props:propsType)=>props.$size?`calc(${props.$size}px / 2.5)`:"60px"};
    font-size: ${(props:propsType)=>props.$size?`calc(${props.$size}px / 7.3)`:"18px"};
    text-align: center;
  }
`;
export default MusicItemStyle;
